package com.lz.yz.member.controller;

import com.lz.yz.base.entity.ReturnValue;
import com.lz.yz.member.model.RequestUser;
import com.lz.yz.member.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class LoginController {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private HttpServletRequest request;

    @Autowired
    private UserService userService;


    /**
     * 用户登陆:手机号、密码
     *
     * @param user 封装的用户信息
     * @return 登陆的结果
     */
    @PostMapping(value = "/user/login")
    public ReturnValue userLogin(@RequestBody RequestUser user) throws Exception {
        return this.userService.validateAndLogin(user);
    }


}
